<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <title>详情</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="description" content="">
    <link rel="stylesheet" href="${path}/lib/weui.min.css">
    <link rel="stylesheet" href="${path}/css/jquery-weui.css">
    <link rel="stylesheet" href="${path}/css/demos.css?dt=20180224">
    <%--<link rel="stylesheet" href="${path}/css/font-awesome.min.css?dt=20180228">--%>
    <style>
        .log-report-img {
            width: 36%;
        }

        .color-green-dep {
            background-color: #46af45 !important;
        }
    </style>
</head>

<body ontouchstart>
<header class='demos-header'>
    <h3 class="demos-title">${title}</h3>
</header>
<div class="bd">
    <div class="page__bd">
        <div class="weui-cells">
            <div class="weui-cell">
                <div class="weui-cell__hd">
                    项目情况: ${report.area} : ${report.project} ,${report.detail}
                    <p>当前状态: ${report.stateDict}</p>
                </div>
            </div>
            <div class="weui-cells__title">
                <c:forEach var="item" items="${report.imgAry}">
                    <a href="${path}/${item}">
                        <img src="${path}/${item}" class="log-report-img">
                    </a>
                </c:forEach>
            </div>
            <div class="weui-cells__tips">流程信息:</div>
            <c:forEach var="item" items="${report.logs}" varStatus="it">
                <a class="weui-cell weui-cell_access" href="#">
                    <div class="weui-cell__bd">
                        <p> ${it.index+1}. ${item.remark}</p>
                    </div>
                    <div class="weui-cell__hd">
                        <label class="weui-label">
                               <fmt:formatDate value="${item.createTime}" pattern="yyyy-MM-dd hh:mm"/>
                        </label>
                    </div>
                </a>
            </c:forEach>

            <c:if test="${op.opFlag eq true and op.opValue eq 8}">
                <div class="weui-cell">
                    <div class="weui-cell__bd">
                        <textarea class="weui-textarea" placeholder="评价" rows="3" id="evalute"
                                  maxlength="200"></textarea>
                        <div class="weui-textarea-counter"><span>0</span>/200</div>
                    </div>
                </div>
            </c:if>

            <c:if test="${report.evaluate ne '' and report.evaluate ne null}">
                <div class="weui-cell">
                    <div class="weui-cell__bd">
                        用户评价: ${report.evaluate}
                    </div>
                </div>
            </c:if>
        </div>
        <c:if test="${op.opFlag eq true}">
            <div class="weui-btn-area sub-btn">
                <a class="weui-btn weui-btn_primary" href="javascript:" id="submit"
                   opValue="${op.opValue}">${op.opName}</a>
            </div>
        </c:if>
    </div>
    <div class="clear" style="height: 52px"></div>
</div>
</div>

<jsp:include page="foot.jsp"/>

<script src="${path}/lib/jquery-2.1.4.js"></script>
<script src="${path}/lib/fastclick.js"></script>
<script src="${path}/js/jquery-weui.js"></script>
<script>
    $(function () {
        FastClick.attach(document.body);
    });

    $('#submit').on('click', function () {
        var that = $(this);
        var opValue = that.attr('opValue');
        //删除
        if (opValue == '-1') {
            var url = '${path}/task/toDelete.do';
            $.post(url, {'reportId':${report.id}}, function (result) {
                if (result.success) {
                    window.location.href = '${path}/task/wait/list.do';
                } else {
                    $.toptip('系统繁忙,请联系管理员');
                }
            }, 'JSON');
        }

        //处理已维修
        if (opValue == '2') {
            var url = '${path}/task/toMyOver.do';
            $.post(url, {'reportId':${report.id}}, function (result) {
                if (result.success) {
                    window.location.href = '${path}/task/wait/my/maintain.do';
                } else {
                    $.toptip('系统繁忙,请联系管理员');
                }
            }, 'JSON');
        }

        //处理已办结
        if (opValue == '9') {
            var url = '${path}/task/toOver.do';
            $.post(url, {'reportId':${report.id}}, function (result) {
                if (result.success) {
                    window.location.href = '${path}/task/wait/list.do';
                } else {
                    $.toptip('系统繁忙,请联系管理员');
                }
            }, 'JSON');
        }

        if (opValue == '8') {
            var url = '${path}/task/toEvalute.do';
            $.post(url, {'reportId':${report.id}, 'evalute': $('#evalute').val()}, function (result) {
                if (result.success) {
                    window.location.href = '${path}/task/over/list.do';
                } else {
                    $.toptip('系统繁忙,请联系管理员');
                }
            }, 'JSON');
        }
    });
</script>

</body>
</html>
